package com.daxia.bumall.model;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

/**
 * Timeline
 */
@Entity
@Table(name = "timeline") 
public class Timeline extends BaseModel {
	/**
	 * id
	 */
	@Id
	@GeneratedValue
	@Column(name = "id")
    private Long id;
	/**
	 * 用户
	 */
	@ManyToOne
	@JoinColumn(name = "user_id")
    private User user;
	/**
	 * 内容
	 */
	@Column(name = "content")
    private String content;
	/**
	 * 图片
	 */
	@Column(name = "images")
    private String images;
	/**
	 * 发表时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")	
	@Column(name = "createTime")
    private Date createTime;
	
	@OneToMany(mappedBy = "timeline")
	private List<TimelineLike> timelineLikes;
	
	@OneToMany(mappedBy = "timeline")
	private List<TimelineComment> timelineCommnets;
	
	
	public Long getId() {
    	return id;
    }
	
    public void setId(Long id) {
    	this.id = id;
    }
	
	public User getUser() {
    	return user;
    }
	
    public void setUser(User user) {
    	this.user = user;
    }
	
	public String getContent() {
    	return content;
    }
	
    public void setContent(String content) {
    	this.content = content;
    }
	
	public String getImages() {
    	return images;
    }
	
    public void setImages(String images) {
    	this.images = images;
    }
	
	public Date getCreateTime() {
    	return createTime;
    }
	
    public void setCreateTime(Date createTime) {
    	this.createTime = createTime;
    }

	public List<TimelineLike> getTimelineLikes() {
		return timelineLikes;
	}

	public void setTimelineLikes(List<TimelineLike> timelineLikes) {
		this.timelineLikes = timelineLikes;
	}

	public List<TimelineComment> getTimelineCommnets() {
		return timelineCommnets;
	}

	public void setTimelineCommnets(List<TimelineComment> timelineCommnets) {
		this.timelineCommnets = timelineCommnets;
	}
    
	
}
